package Wizard.constant;

import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.DefaultHandler;

public class MyContentHandler extends DefaultHandler {
      String FLAG,tagName;
      private static MyContentHandler mycontenthandler;
  	public static MyContentHandler getInstance(){
  	if(mycontenthandler==null){
  		mycontenthandler=new MyContentHandler();
  	}
  	return mycontenthandler;
  	}
	@Override
	public void characters(char[] ch, int start, int length)
			throws SAXException {
		FLAG=new String(ch,start,length);
	}

	@Override
	public void endDocument() throws SAXException {
		System.out.println("+++++++end++++++");
	}

	@Override
	public void endElement(String uri, String localName, String qName)
			throws SAXException {
		FlagModel flagmodel=FlagModel.getInstance();
		flagmodel.setFlag(FLAG);
		System.out.println("++++++result++++"+flagmodel.getFlag());
	}

	@Override
	public void startDocument() throws SAXException {
		System.out.println("++++++begin+++++");
	}

	@Override
	public void startElement(String uri, String localName, String qName,
			Attributes attributes) throws SAXException {
		tagName=uri;
		if(uri.equals("http://tempuri.org/")){
			System.out.println("++++success");
			
		}
	}
	
}
